package com.qf.controller;

import com.qf.entity.Hotal;
import com.qf.entity.R;
import com.qf.entity.SearchParams;
import com.qf.service.ISearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    private ISearchService searchService;

    /**
     * 搜索酒店列表
     * @return
     */
    @RequestMapping("/hotals")
    public R<List<Hotal>> searchHotals(SearchParams searchParams){
        System.out.println("开始进行搜索：" + searchParams);
        //调用业务层执行搜索
        List<Hotal> hotals = searchService.searchHotal(searchParams);
        return new R<List<Hotal>>().setData(hotals);
    }
}
